Skip to content

Add JDBC transaction duration metrics#19003

Merged
trask merged 1 commit into
open-telemetry:mainfrom
trask:fix-jdbc-transaction-metrics
Jun 16, 2026
Merged

Add JDBC transaction duration metrics#19003
trask merged 1 commit into
open-telemetry:mainfrom
trask:fix-jdbc-transaction-metrics

Conversation

@trask

@trask trask commented Jun 15, 2026

Copy link
Copy Markdown
Member

Summary

  • record stable db.client.operation.duration metrics for JDBC transaction spans

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enables recording of the stable db.client.operation.duration metric for JDBC transaction operations (e.g., COMMIT), aligning JDBC transaction instrumentation with the existing statement-level DB client metrics behavior.

Changes:

  • Enabled DB client operation duration metrics on the JDBC transaction instrumenter.
  • Added a regression test to assert db.client.operation.duration is emitted for a transaction (commit) with the expected attribute keys.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
instrumentation/jdbc/library/src/main/java/io/opentelemetry/instrumentation/jdbc/internal/JdbcInstrumenterFactory.java Adds DbClientMetrics operation metrics to the transaction instrumenter so transaction spans contribute to db.client.operation.duration.
instrumentation/jdbc/library/src/test/java/io/opentelemetry/instrumentation/jdbc/datasource/JdbcTelemetryTest.java Adds a test that exercises a transaction commit and asserts the stable DB client duration metric is emitted with expected attribute keys.

@trask trask marked this pull request as ready for review June 15, 2026 18:27
@trask trask requested a review from a team as a code owner June 15, 2026 18:27
@trask trask added this to the v2.29.0 milestone Jun 15, 2026
@trask trask merged commit 3fd1479 into open-telemetry:main Jun 16, 2026
97 checks passed
@trask trask deleted the fix-jdbc-transaction-metrics branch June 16, 2026 03:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants